package cn.datawin.http;

import cn.hutool.http.HttpUtil;

import java.util.concurrent.*;

public class Demo1 {

    public static void main(String[] args) throws InterruptedException {
        ExecutorService executorService = Executors.newFixedThreadPool(200);
        while (true) {

            final CountDownLatch countDownLatch = new CountDownLatch(200);
            for (int i = 0; i < 200; i++) {
                executorService.submit(new Callable<Object>() {
                    public Object call() throws Exception {
                        try {
                            String s = HttpUtil.get("http://localhost:9000/check1");
                            System.out.println("res----" + s);
                        } catch (Exception e) {
                            throw new RuntimeException(e);
                        } finally {
                            countDownLatch.countDown();
                        }
                        return null;
                    }
                });
            }
            countDownLatch.await();
            TimeUnit.SECONDS.sleep(1);
        }


    }
}
